package game;


public class Location {

  public static final String[] charIndices = 
  {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 
    "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
    "u", "v", "w", "x", "y", "z"};
  
  
  public static final Location RESIGN_MOVE = new Location(-1, -1);


  private final int x ; 
  private final int y ;


  public Location (int x, int y) {
    this.x = x ;
    this.y = y ;
  }


  @Override
  public Location clone() {
    return new Location(x, y);
  }


  @Override
  public boolean equals(Object other) {
    if (! (other instanceof Location)) return false;
    return ((Location)other).getX() == x && ((Location)other).getY() == y;
  }


  public int getX() { return x; }


  public int getY() {	return y; }


  public boolean isResignation() { return equals(RESIGN_MOVE); }


  @Override
  public String toString(){return x == y && x == -1 ? "resign" : charIndices[y] + x;}

}
